<%@ page contentType="text/html;charset=utf-8" language="java"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html:html>
<head>
		<META http-equiv=Content-Type content="text/html; charset=utf-8">
		<LINK href="../styles/stylewang.css"  type=text/css rel=stylesheet>
		<LINK href="styles/stylewang.css"  type=text/css rel=stylesheet>
		<LINK href="xtree.css"  type=text/css rel=stylesheet>
		
		<LINK href="styles/sciencee.css"  type=text/css rel=stylesheet>
		<LINK href="../styles/sciencee.css"  type=text/css rel=stylesheet>
		<style type="text/css"></style>
		<title>CGProject</title>
		<html:base/>
</head>
<script language="javaScript" src="../../js/calendar.js"></script>
<%String id = (String)request.getAttribute("ID");%>
<body>
<table border="0" width="100%" cellspacing="0" id="table6"0>
	<tr>
		<td colspan="6" width="85%" id="onlybt">&nbsp; <b><bean:message key="shotgroup"/>&nbsp;<font color="#990000"><bean:write name="sgp" property="shotGroupName"/></font><bean:message key="shotgroup.information"/></b>
		</td>
	</tr>
	<logic:equal name="sgps_empty" value="false"><tr>
		<td  width="15%" id="leftcenter">
		<b>&nbsp; <bean:message key="shotgroup.name"/><br></b></td>		
		<td width="53%" colspan="5" id="rightcenter">
		<b><font face="Verdana">&nbsp; </font><br></b></td>		
	</tr></logic:equal>
	<logic:equal name="sgps_empty" value="true"><tr>
		<td width="15%" colspan="5" id="leftcenter">&nbsp; 
		<font color="#990000"><bean:message key="shotgroup.nosubgroup"/></font></td>		
		<td width="53%" id="rightcenter">&nbsp;
		　</td>		
	</tr></logic:equal>
	<logic:iterate id="element" name="sgps">
	<tr>
		<td width="15%" id="leftcenter">
		&nbsp;&nbsp;<bean:write name="element" property="shotGroupName"/></td>		
		<td width="53%" colspan="5" id="rightcenter">
		&nbsp;<html:link page="/intoModSGroup.do" paramId="SGroupID" paramName="element" paramProperty="shotGroupId">[<bean:message key="modify"/>]</html:link>&nbsp;&nbsp;
		<a href="../del.do?FatherType=Shotgroup&FatherId=<%=id%> &Type=Shotgroup&Id=<bean:write name="element" property="shotGroupId"/>" onclick="return   confirm('<bean:message key="confirmdel"/>?')">[<bean:message key="delete"/>]</a></td>		
	</tr>
	</logic:iterate>
	<logic:equal name="shots_empty" value="false"><tr>
		<td  width="12%" id="btleftbian">
		<b>&nbsp; <bean:message key="shot.name"/></b></td>
		<td width="20%" id="btcenterbian">
		<b>&nbsp; <bean:message key="shot.planstart"/></b></td>
		<td width="20%" id="btcenterbian">
		<b>&nbsp; <bean:message key="shot.planend"/></b></td>
		<td width="23%" id="btcenterbian">
		<b>&nbsp;Edit<br></b></td>
		<td width="5%" id="btcenterbian">
		<b><bean:message key="shot.totalframe"/></b></td>		
		<td width="53%" id="btrightbian">
		<b><font face="Verdana">&nbsp; </font><br></b></td>		
	</tr></logic:equal>
	<logic:equal name="shots_empty" value="true"><tr>
		<td width="15%" id="leftcenter">&nbsp;
		<font color="#990000"><bean:message key="shot.noshot"/></font><br></td>		
		<td width="53%" id="rightcenter" colspan="5">
		　</td>		
	</tr></logic:equal>
	<logic:iterate id="element" name="shots">
	<tr>
		<td width="15%" id="leftcenter">
		&nbsp;&nbsp;<bean:write name="element" property="shotName"/></td>
		<td width="20%" id="leftcenter">
		&nbsp;&nbsp;<bean:write name="element" property="planStartTime" format="yyyy-MM-dd"/></td>
		<td width="20%" id="leftcenter">
		&nbsp;&nbsp;<bean:write name="element" property="planEndTime" format="yyyy-MM-dd"/></td>
		<td width="23%" id="leftcenter">
		&nbsp;&nbsp;<bean:write name="element" property="edit"/></td>
		<td width="5%" id="leftcenter">
		&nbsp;<bean:write name="element" property="shotTotalFrameNum"/></td>		
		<td width="53%" id="rightcenter">
		&nbsp;<html:link page="/intoModShot.do" paramId="shotId" paramName="element" paramProperty="shotId">[<bean:message key="basicmodify"/>]</html:link>&nbsp;&nbsp;
		<a href="../del.do?FatherType=Shotgroup&FatherId=<%=id%> &Type=Shot&Id=<bean:write name="element" property="shotId"/>" onclick="return   confirm('<bean:message key="confirmdel"/>?')">[<bean:message key="delete"/>]</a></td>		
	</tr>
	</logic:iterate>
	<tr><TD id="tdtop" colspan="6">&nbsp;</TD></tr>
</table>
<html:form action="/addShotGroup"  onsubmit="return submitAddShotGroup()">
<html:hidden property="id" value="<%=id%>"/>
<table border="0" width="100%" cellspacing="0" id="tabletable" cellpadding="0">
	<tr>
		<td  width="8%" id="btleftbian"><font color="#990000">&nbsp;<bean:message key="shotgroup.add"/></font></td>
		<td  width="93%" id="btrightbian"> 
		<bean:message key="shotgroup"/></td>
	</tr>	


	<tbody id="tbDetailUsed">
	<tr>
		<td width="8%" id="leftcenter"><input type="checkbox"  disabled name="record_select" ></td>
		<td width="93%" id="rightcenter">
		<html:text property="name" size="40" style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/></td>
	</tr>	


	</tbody>
	
	<tr>
		<td width="100%" id="rightbottom" colspan="2">
		<input type="button" value='<bean:message key="submit"/>' name="B1" style="font-family: Tahoma; font-size: 11px" onClick="submitAddShotGroup()">
		&nbsp;&nbsp;&nbsp;&nbsp;
		</td>
	</tr>
	
	
</table>
<table id="tbDetailPrepare" style="display:none" cellspacing="0" cellpadding="0">
	<tr>
		<td  width="8%" id="btleftbian"><input type="checkbox" name="record_select" ></td>
		<td width="93%" id="btrightbian">
		<html:text property="name" size="40" style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/></td>
	</tr>
</table>
</html:form>
<html:form action="/addShot">
<html:hidden property="groupId" value="<%=id%>"/>
<table border="0" width="100%" cellspacing="0" id="tabletable" cellpadding="0">
	<tr>
		<td width="8%" id="btleftbian"><font color="#990000">&nbsp;<bean:message key="shot.add"/></font></td>
		<td width="18%" id="btcenterbian"> 
		<bean:message key="shot.name"/></td>
		<td width="20%" id="btcenterbian"> 
		<bean:message key="shot.planstart"/></td>
		<td width="20%" id="btcenterbian"> 
		<bean:message key="shot.planend"/></td>
		<td width="5%" id="btcenterbian"> 
		<bean:message key="shot.totalframe"/></td>
		<td width="25%" id="btrightbian"> 
		Edit</td>
	</tr>	

	<script language="javascript">var i=0;</script>
	<tbody id="tbDetailUsed1">
	<tr>
		<td width="8%" id="leftcenter"><input type="checkbox" disabled  name="record_select" ></td>
		<td width="18%" id="leftcenter">
		<html:text property="name" size="20" style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/></td>
		<td width="20%" id="leftcenter">
		<html:text property="startTime" size="20" readonly="true" onclick="showcalendar(event, this)" onfocus="showcalendar(event, this)"  style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/>&nbsp;</td>
		<td width="20%" id="leftcenter">
		<html:text property="finishTime" size="20" readonly="true" onclick="showcalendar(event, this)" onfocus="showcalendar(event, this)"  style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/>&nbsp;</td>
		<td width="5%" id="leftcenter">
		<html:text property="framoNo" size="5" style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/></td>
		<td width="25%" id="rightcenter">
		<html:select property="edit" style="border:1px solid #C0C0C0; font-family: Tahoma; font-size: 11px">
					<html:option value="Cut">Cut</html:option>
					<html:option value="Dissole">Dissole</html:option>
					<html:option value="FadeIn">FadeIn</html:option>
					<html:option value="FadeOut">FadeOut</html:option>
		</html:select>
		</td>

		

	</tr>	

	</tbody>
	
	<tr>
		<td  width="100%" id="rightbottom" colspan="6">
		<input type="button" value='<bean:message key="submit"/>' name="B1" style="font-family: Tahoma; font-size: 11px" onClick="submitAddShot()">
		&nbsp;&nbsp;&nbsp;&nbsp;
		</td>
	</tr>
	
	
</table>
<table id="tbDetailPrepare1" style="display:none" cellspacing="0" cellpadding="0">
	<tr>
		<script language="javascript">i++</script>
		<td  width="8%" ><input type="checkbox" name="record_select" >fdg<br><br></td>
		<td width="18%" >
		<html:text property="name" size="20" style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/><br><br></td>
		<td width="20%" >
		<html:text property="startTime" size="20" readonly="true"  onclick="showcalendar(event, this)" onfocus="showcalendar(event, this)" style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/>
		<input type="button" value="DATE" name="calButton" onClick="CreateMonthView(startTime[i])"  style="font-family: Tahoma; font-size: 11px" ><br><br></td>
		<td width="20%" >
		<html:text property="finishTime" size="20" readonly="true"  onclick="showcalendar(event, this)" onfocus="showcalendar(event, this)" style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/>
		<input type="button" value="DATE" name="calButton1" onClick="CreateMonthView(finishTime[i])"  style="font-family: Tahoma; font-size: 11px" ><br><br></td>
		<td width="5%" >
		<html:text property="framoNo" size="5" style="border:1px solid #FFFFFF; font-family: Tahoma; font-size: 11px; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px"/><br><br></td>
		<td  width="25%" >yy<html:select property="edit" style="border:1px solid #C0C0C0; font-family: Tahoma; font-size: 11px"><html:option value="Cut">Cut</html:option>
					<html:option value="Dissole">Dissole</html:option>
					<html:option value="FadeIn">FadeIn</html:option>
					<html:option value="FadeOut">FadeOut</html:option>
		</html:select>
		<br><br></td>

		

	</tr>
</table>
</html:form>


</body>
</html:html>
<script language="javascript">
function submitAddShotGroup()
{
	var counter=tbDetailUsed.rows;
	var wrong_counter1=0;
	var wrong_counter2=0;
	for(var i=0;i<counter.length;i++)
	{
		if(document.addShotGroupForm.name[i].value=="")
		{
			alert("Please input "+(i+1)+" 's name");
			wrong_counter1++;
			break;
		}
	}
	for(var j=0;j<counter.length;j++)
	{
		for(var k=j;k<counter.length;k++)
		{
			if(document.addShotGroupForm.name[j].value==document.addShotGroupForm.name[k].value&&j!=k&&wrong_counter1==0)
			{
				alert(" "+(j+1)+" and "+(k+1)+" cannot be the same name");
				wrong_counter2++;
				break;
			}

		}
	}
	if(wrong_counter1!=0||wrong_counter2!=0)
	{
		return;
	}
	document.addShotGroupForm.submit();
}
function addDetailProcess(afterRowIndex)		//增加明细
{
	
	
	var alltbDetailUsed = document.all("tbDetailUsed").rows;
	
	var theFirstSelectedDetail;
	if (afterRowIndex==null)
	{
	  theFirstSelectedDetail=alltbDetailUsed.length-2;
	}
	else theFirstSelectedDetail=afterRowIndex;
	var newRow = document.all("tbDetailPrepare").rows[0].cloneNode(true);
	var desRow = alltbDetailUsed[theFirstSelectedDetail+1];
//		desRow.parentElement.insertBefore(newRow,desRow );
	desRow.parentElement.appendChild(newRow);
	
	return alltbDetailUsed.length;
}
function delDetailProcess()						//删除明细
{
	var tag="";
	var alltbDetailUsed = document.all("tbDetailUsed").rows;
	for(var ii=0;ii<alltbDetailUsed.length;ii++)
	{
		
		if (alltbDetailUsed[ii].all("record_select").checked==true)
		{
			tag="true";
			break;		
		}
		else
		{
			tag="false";
		}
	}
	if(tag=="false")
	{
		alert("Please select a clause");
	}
	else
	{
		for(var i=0;i<alltbDetailUsed.length;i++)
		{
			if (alltbDetailUsed[i].all("record_select").checked==true)
			{
				document.all("tbDetailUsed").deleteRow(i);
				i=i-1;
			}
		}
	}
}
function submitAddShot()
{
	var counter=tbDetailUsed1.rows;
	var wrong_counter1=0;
	var wrong_counter2=0;
	var wrong_counter3=0;
	for(var i=0;i<counter.length;i++)
	{
		if(document.addShotForm.name[i].value=="")
		{
			alert("Please input "+(i+1)+" 's name");
			wrong_counter1++;
			break;
		}
	}
	for(var l=0;l<counter.length;l++)
	{
		if(document.addShotForm.startTime[l].value>document.addShotForm.finishTime[l].value)
		{
			alert("The clause "+(l+1)+" 's starttime is later than its endtime");
			wrong_counter3++;
			break;
		}
	}

	for(var j=0;j<counter.length;j++)
	{
		for(var k=j;k<counter.length;k++)
		{
			if(document.addShotForm.name[j].value==document.addShotForm.name[k].value&&j!=k&&wrong_counter1==0)
			{
				alert(""+(j+1)+" and "+(k+1)+" cannot be the same name");
				wrong_counter2++;
				break;
			}

		}
	}
	if(wrong_counter1!=0||wrong_counter2!=0||wrong_counter3!=0)
	{
		return;
	}
	document.addShotForm.submit();
}
function addDetailProcess1(afterRowIndex)		//增加明细
{
	
	
	var alltbDetailUsed = document.all("tbDetailUsed1").rows;
	
	var theFirstSelectedDetail;
	if (afterRowIndex==null)
	{
	  theFirstSelectedDetail=alltbDetailUsed.length-2;
	}
	else theFirstSelectedDetail=afterRowIndex;
	var newRow = document.all("tbDetailPrepare1").rows[0].cloneNode(true);
	var desRow = alltbDetailUsed[theFirstSelectedDetail+1];
//		desRow.parentElement.insertBefore(newRow,desRow );
	desRow.parentElement.appendChild(newRow);
	
	return alltbDetailUsed.length;
}
function delDetailProcess1()						//删除明细
{
	var tag="";
	var alltbDetailUsed = document.all("tbDetailUsed1").rows;
	for(var ii=0;ii<alltbDetailUsed.length;ii++)
	{
		
		if (alltbDetailUsed[ii].all("record_select").checked==true)
		{
			tag="true";
			break;		
		}
		else
		{
			tag="false";
		}
	}
	if(tag=="false")
	{
		alert("Please select a clause !");
	}
	else
	{
		for(var i=0;i<alltbDetailUsed.length;i++)
		{
			if (alltbDetailUsed[i].all("record_select").checked==true)
			{
				document.all("tbDetailUsed1").deleteRow(i);
				i=i-1;
			}
		}
	}
}





</script>